Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AHM] Add Polkadot call filtering #559

Merged
merged 8 commits into from
Jan 27, 2025

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Jan 23, 2025

To be merged into the AHM working branch.

Changes:

  • Configure the RC Migrator pallet as call filter for the Polkadot Relay chain

  • Test

  • Does not require a CHANGELOG entry

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez marked this pull request as ready for review January 23, 2025 17:27
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach! We should get input from a wider group on the individual filtered calls/pallets, maybe based on the owners on the excel sheet

pallets/rc-migrator/src/lib.rs Outdated Show resolved Hide resolved
relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
// ParaSessionInfo has no calls
ParasDisputes(..) => (OFF, ON), // TODO check with security
ParasSlashing(..) => (OFF, ON), // TODO check with security
OnDemand(..) => (OFF, ON),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we get paritytech/polkadot-sdk#5990 merged in time we should try to avoid filtering on-demand, as there will no longer be a balances dependency and we should avoid a situation where parachains can't make blocks through the migration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a TODO

relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
Registrar(..) => (OFF, ON),
Slots(..) => (OFF, ON), // TODO not sure
Auctions(..) => (OFF, OFF),
Crowdloan(..) => (OFF, ON), // TODO maybe only payouts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea probably just withdraw, refund and dissolve.
Ideally we'd transfer this state to AH and allow people to withdraw or refund there directly, but it would be basically an entirely new pallet and would break all the crowdloan apps maybe unnecessarily. That's likely going to be the next phase of AHM though when the EDs go up. Still like 20 months until the last crowdloans expire so we need something long term

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impact is very low, I would just disable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impact is very low, I would just disable.

You mean also after the migration? I was thinking about enabling the withdraw function after the migration again.

Copy link
Member Author

@ggwpez ggwpez Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to:

Crowdloan(crowdloan::Call::<Runtime>::dissolve { .. } | crowdloan::Call::<Runtime>::refund { .. } | crowdloan::Call::<Runtime>::withdraw { .. }) => (OFF, ON),
Crowdloan(..) => (OFF, OFF),

FastUnstake(..) => (OFF, OFF),
// DelegatedStaking has on calls
// ParachainsOrigin has no calls
Configuration(..) => (OFF, ON),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Configuration(..) => (OFF, ON),
Configuration(..) => (ON, ON),

All root calls

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also can have a similar impl for the EnsureOrigin if needed to let only Fellows to command some calls during migration. I do not think we can execute the root fast enough.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea good idea.

relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
let mut t: sp_io::TestExternalities =
frame_system::GenesisConfig::<T>::default().build_storage().unwrap().into();

// MQ calls are never filtered:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we get to the bottom of the prioritisation of system messages? I lost track of the status of your streaking work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea it worked here but we should get it audited & merged paritytech/polkadot-sdk#6059

}

fn is_forbidden(call: &polkadot_runtime::RuntimeCall) -> bool {
let Err(err) = call.clone().dispatch(RuntimeOrigin::signed(AccountId32::from([0; 32]))) else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a nice test to run on basically every pallet and extrinsic during the migration except for a few exceptions that are explicitly allowed from signed origins - the ones that are root only will fail anyway from this origin.

We could then have a separate check for the root calls that should be filtered, with the baseline being that all root calls are allowed except the ones we know will cause problems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we could do that. Currently we need to manually construct the call arguments as well since our RuntimeCall enum does not implement an Arbitrary trait.

FastUnstake(..) => (OFF, OFF),
// DelegatedStaking has on calls
// ParachainsOrigin has no calls
Configuration(..) => (OFF, ON),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also can have a similar impl for the EnsureOrigin if needed to let only Fellows to command some calls during migration. I do not think we can execute the root fast enough.

Registrar(..) => (OFF, ON),
Slots(..) => (OFF, ON), // TODO not sure
Auctions(..) => (OFF, OFF),
Crowdloan(..) => (OFF, ON), // TODO maybe only payouts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impact is very low, I would just disable.

relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
relay/polkadot/src/lib.rs Outdated Show resolved Hide resolved
ggwpez and others added 3 commits January 27, 2025 12:30
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez
Copy link
Member Author

ggwpez commented Jan 27, 2025

Going to merge. Tests should run after #561

@ggwpez ggwpez merged commit 952330a into dev-asset-hub-migration Jan 27, 2025
21 of 47 checks passed
@ggwpez ggwpez deleted the oty-ahm-pause-calls branch January 27, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants